Skip to content

test: add renderer client tests for chat_template_kwargs materialization#2711

Open
mvanhorn wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
mvanhorn:fix/2572-renderer-client-chat-template-kwargs
Open

test: add renderer client tests for chat_template_kwargs materialization#2711
mvanhorn wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
mvanhorn:fix/2572-renderer-client-chat-template-kwargs

Conversation

@mvanhorn
Copy link
Copy Markdown

@mvanhorn mvanhorn commented Jun 4, 2026

Summary

Adds renderer-client test coverage proving that chat_template_kwargs are materialized into the rendered prompt and that omitting them falls back to each model's chat-template default rather than a hardcoded value.

Why this matters

Issue #2572 asks for tests confirming that the renderer path in src/prime_rl/utils/client.py respects model-specific defaults and that enabling renderer-based tokenization did not silently break other model families. The cases called out are reasoning_effort for gpt-oss and enable_thinking for qwen, nemotron, and laguna; there was no prior coverage of this behavior.

Testing

tests/unit/utils/test_client.py gains a parametrized class covering: reasoning_effort passed for gpt-oss appearing verbatim in the rendered prompt, enable_thinking=false suppressing reasoning markup for qwen/nemotron/laguna, omitting enable_thinking resolving to the tokenizer chat-template default, an unsupported kwarg surfacing a clear error, and a non-renderer path left unaffected. The change is test-only; src/prime_rl/utils/client.py is untouched. Covered by the new tests in this PR; full suite runs in CI.

Fixes #2572


Note

Low Risk
Test-only changes with no runtime or security impact.

Overview
Adds unit tests in tests/unit/utils/test_client.py that exercise the renderer client path (via a stub RendererClient and prompt-capturing fake renderer) to lock in how sampling_args.extra_body.chat_template_kwargs affect rendering.

reasoning_effort for gpt-oss is expected to show up in the rendered prompt and not be forwarded on the native generate sampling_params. enable_thinking is covered for Qwen 3.5, Nemotron-3, and Laguna: false suppresses reasoning markup; when omitted, behavior follows per-model defaults (parametrized). Passing an unsupported kwarg (e.g. enable_thinking on gpt-oss) must raise a clear ValidationError.

A separate test asserts setup_clients does not attach renderer_config / renderer_model_name to the default OpenAI chat completions client when only renderer-related args are passed—guarding the non-renderer path.

No production code changes; this is regression coverage for issue #2572.

Reviewed by Cursor Bugbot for commit d1c2edf. Bugbot is set up for automated code reviews on this repo. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add renderer client tests for chat_template_kwargs

1 participant